package com.compty.paint.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.compty.paint.util.Constants;
import com.compty.security.domain.User;

@Entity
@Table(name = "t_backimage")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE,include="non-lazy")
public class BackgroundImage implements Serializable{

	private static final long serialVersionUID = -3512534191833404581L;

	private Long id;
	
	private String title;
	
	private Float width;
	private Float height;
	
	private String size_vertical;//竖向大小
	private String size_horizontal;//横向大小
	private String size_square;//正方形大小
	private String position; //位置
	
	/*
	private String size_one_vertical;//1档(30-50cm)
	private String size_two_vertical;//2档(50-70cm)
	private String size_three_vertical;//3档(70-90cm)
	private String size_four_vertical;//4档(90-110cm)
	private String size_five_vertical;//5档(110-130cm)
	private String size_six_vertical;//6档(130-160cm)
	private String size_seven_vertical;//7档(160-200cm)
	
	private String size_one_square;//1档(30-50cm)
	private String size_two_square;//2档(50-70cm)
	private String size_three_square;//3档(70-90cm)
	private String size_four_square;//4档(90-110cm)
	private String size_five_square;//5档(110-130cm)
	private String size_six_square;//6档(130-160cm)
	private String size_seven_square;//7档(160-200cm)
	
	private String size_one_horizontal;//1档(20-40cm)
	private String size_two_horizontal;//2档(40-80cm)
	private String size_three_horizontal;//3档(80-120cm)
	private String size_four_horizontal;//4档(120-150cm)
	private String size_five_horizontal;//5档(150-180cm)
	private String size_six_horizontal; //6档(180-220cm)
	
	private String position_left_up;
	private String position_middle_up;
	private String position_right_up;
	private String position_left;
	private String position_middle;
	private String position_right;
	private String position_left_down;
	private String position_middle_down;
	private String position_right_down;
	*/
	
	/************ 上传时间 ****************/
	private Date uploadTime;
	
	/************ 最后修改时间  ****************/
	private Date modifyTime;
	
	/************ 录入人  ****************/
	private User entryPerson;
	
	/************ 大图片  ****************/
	private ImageInfo imageInfo;
	
	private String imagepath;//图片路径
	
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "title", length = 100)
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "uploadtime")
	public Date getUploadTime() {
		return uploadTime;
	}

	public void setUploadTime(Date uploadTime) {
		this.uploadTime = uploadTime;
	}

	@Column(name = "modifytime")
	public Date getModifyTime() {
		return modifyTime;
	}

	public void setModifyTime(Date modifyTime) {
		this.modifyTime = modifyTime;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="userinfo_id")
	public User getEntryPerson() {
		return entryPerson;
	}

	public void setEntryPerson(User entryPerson) {
		this.entryPerson = entryPerson;
	}

	@ManyToOne(fetch = FetchType.LAZY,cascade =  {CascadeType.REMOVE })
	@JoinColumn(name="image_id")
	public ImageInfo getImageInfo() {
		return imageInfo;
	}

	public void setImageInfo(ImageInfo imageInfo) {
		this.imageInfo = imageInfo;
	}

	@Column(name = "width")
	public Float getWidth() {
		return width;
	}

	public void setWidth(Float width) {
		this.width = width;
	}

	@Column(name = "height")
	public Float getHeight() {
		return height;
	}

	public void setHeight(Float height) {
		this.height = height;
	}

	@Column(name = "size_vertical")
	public String getSize_vertical() {
		return size_vertical;
	}

	public void setSize_vertical(String sizeVertical) {
		size_vertical = sizeVertical;
	}

	@Column(name = "size_horizontal")
	public String getSize_horizontal() {
		return size_horizontal;
	}

	public void setSize_horizontal(String sizeHorizontal) {
		size_horizontal = sizeHorizontal;
	}

	@Column(name = "size_square")
	public String getSize_square() {
		return size_square;
	}

	public void setSize_square(String sizeSquare) {
		size_square = sizeSquare;
	}
	
	@Column(name = "position")
	public String getPosition() {
		return position;
	}

	public void setPosition(String position) {
		this.position = position;
	}
	
	@Transient
	public String getImagepath() {
		if( imageInfo!= null ){
			this.imagepath = Constants.IMAGE_SERVER+Constants.BackgroundFlag+"/"+imageInfo.getId()+"."+imageInfo.getSuffix();
		}
		else{
			this.imagepath = Constants.IMAGE_SERVER ;
		}
		return imagepath;
	}

	/*
	@Column(name = "position_left_up")
	public String getPosition_left_up() {
		return position_left_up;
	}

	public void setPosition_left_up(String positionLeftUp) {
		position_left_up = positionLeftUp;
	}

	@Column(name = "position_middle_up")
	public String getPosition_middle_up() {
		return position_middle_up;
	}

	public void setPosition_middle_up(String positionMiddleUp) {
		position_middle_up = positionMiddleUp;
	}

	@Column(name = "position_right_up")
	public String getPosition_right_up() {
		return position_right_up;
	}

	public void setPosition_right_up(String positionRightUp) {
		position_right_up = positionRightUp;
	}

	@Column(name = "position_left")
	public String getPosition_left() {
		return position_left;
	}

	public void setPosition_left(String positionLeft) {
		position_left = positionLeft;
	}

	@Column(name = "position_middle")
	public String getPosition_middle() {
		return position_middle;
	}

	public void setPosition_middle(String positionMiddle) {
		position_middle = positionMiddle;
	}

	@Column(name = "position_right")
	public String getPosition_right() {
		return position_right;
	}

	public void setPosition_right(String positionRight) {
		position_right = positionRight;
	}

	@Column(name = "position_left_down")
	public String getPosition_left_down() {
		return position_left_down;
	}

	public void setPosition_left_down(String positionLeftDown) {
		position_left_down = positionLeftDown;
	}

	@Column(name = "position_middle_down")
	public String getPosition_middle_down() {
		return position_middle_down;
	}

	public void setPosition_middle_down(String positionMiddleDown) {
		position_middle_down = positionMiddleDown;
	}

	@Column(name = "position_right_down")
	public String getPosition_right_down() {
		return position_right_down;
	}

	public void setPosition_right_down(String positionRightDown) {
		position_right_down = positionRightDown;
	}

	@Column(name = "size_one_vertical")
	public String getSize_one_vertical() {
		return size_one_vertical;
	}

	public void setSize_one_vertical(String sizeOneVertical) {
		size_one_vertical = sizeOneVertical;
	}

	@Column(name = "size_two_vertical")
	public String getSize_two_vertical() {
		return size_two_vertical;
	}

	public void setSize_two_vertical(String sizeTwoVertical) {
		size_two_vertical = sizeTwoVertical;
	}

	@Column(name = "size_three_vertical")
	public String getSize_three_vertical() {
		return size_three_vertical;
	}

	public void setSize_three_vertical(String sizeThreeVertical) {
		size_three_vertical = sizeThreeVertical;
	}

	@Column(name = "size_four_vertical")
	public String getSize_four_vertical() {
		return size_four_vertical;
	}

	public void setSize_four_vertical(String sizeFourVertical) {
		size_four_vertical = sizeFourVertical;
	}

	@Column(name = "size_five_vertical")
	public String getSize_five_vertical() {
		return size_five_vertical;
	}

	public void setSize_five_vertical(String sizeFiveVertical) {
		size_five_vertical = sizeFiveVertical;
	}

	@Column(name = "size_six_vertical")
	public String getSize_six_vertical() {
		return size_six_vertical;
	}

	public void setSize_six_vertical(String sizeSixVertical) {
		size_six_vertical = sizeSixVertical;
	}

	@Column(name = "size_seven_vertical")
	public String getSize_seven_vertical() {
		return size_seven_vertical;
	}

	public void setSize_seven_vertical(String sizeSevenVertical) {
		size_seven_vertical = sizeSevenVertical;
	}

	@Column(name = "size_one_horizontal")
	public String getSize_one_horizontal() {
		return size_one_horizontal;
	}

	public void setSize_one_horizontal(String sizeOneHorizontal) {
		size_one_horizontal = sizeOneHorizontal;
	}

	@Column(name = "size_two_horizontal")
	public String getSize_two_horizontal() {
		return size_two_horizontal;
	}

	public void setSize_two_horizontal(String sizeTwoHorizontal) {
		size_two_horizontal = sizeTwoHorizontal;
	}

	@Column(name = "size_three_horizontal")
	public String getSize_three_horizontal() {
		return size_three_horizontal;
	}

	public void setSize_three_horizontal(String sizeThreeHorizontal) {
		size_three_horizontal = sizeThreeHorizontal;
	}

	@Column(name = "size_four_horizontal")
	public String getSize_four_horizontal() {
		return size_four_horizontal;
	}

	public void setSize_four_horizontal(String sizeFourHorizontal) {
		size_four_horizontal = sizeFourHorizontal;
	}

	@Column(name = "size_five_horizontal")
	public String getSize_five_horizontal() {
		return size_five_horizontal;
	}

	public void setSize_five_horizontal(String sizeFiveHorizontal) {
		size_five_horizontal = sizeFiveHorizontal;
	}

	@Column(name = "size_six_horizontal")
	public String getSize_six_horizontal() {
		return size_six_horizontal;
	}

	public void setSize_six_horizontal(String sizeSixHorizontal) {
		size_six_horizontal = sizeSixHorizontal;
	}

	@Column(name = "size_one_square")
	public String getSize_one_square() {
		return size_one_square;
	}

	public void setSize_one_square(String sizeOneSquare) {
		size_one_square = sizeOneSquare;
	}

	@Column(name = "size_two_square")
	public String getSize_two_square() {
		return size_two_square;
	}

	public void setSize_two_square(String sizeTwoSquare) {
		size_two_square = sizeTwoSquare;
	}

	@Column(name = "size_three_square")
	public String getSize_three_square() {
		return size_three_square;
	}

	public void setSize_three_square(String sizeThreeSquare) {
		size_three_square = sizeThreeSquare;
	}

	@Column(name = "size_four_square")
	public String getSize_four_square() {
		return size_four_square;
	}

	public void setSize_four_square(String sizeFourSquare) {
		size_four_square = sizeFourSquare;
	}

	@Column(name = "size_five_square")
	public String getSize_five_square() {
		return size_five_square;
	}

	public void setSize_five_square(String sizeFiveSquare) {
		size_five_square = sizeFiveSquare;
	}

	@Column(name = "size_six_square")
	public String getSize_six_square() {
		return size_six_square;
	}

	public void setSize_six_square(String sizeSixSquare) {
		size_six_square = sizeSixSquare;
	}

	@Column(name = "size_seven_square")
	public String getSize_seven_square() {
		return size_seven_square;
	}

	public void setSize_seven_square(String sizeSevenSquare) {
		size_seven_square = sizeSevenSquare;
	}
	*/
	
}
